package org.example.RabbitListener;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Component
public class SpringRabbitListener 
{
	@RabbitListener(
			bindings = @QueueBinding(
					value = @Queue(name = "dlx.queue", durable = "true"),
					exchange = @Exchange(name = "dlx.direct", type = ExchangeTypes.DIRECT),
					key = "dlx.key" // 死信路由键
			)
	)
	public void listener(String mes) throws InterruptedException 
	{
		System.out.println(LocalDateTime.now() +" 死信接受消息："+mes);
	}
}
